package cn.chengdu.controller;

import cn.chengdu.entity.Department;
import cn.chengdu.service.IDepartmentService;
import com.alibaba.fastjson.JSON;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller

public class DepartmentTest {
    @Autowired
    private IDepartmentService iDepartmentService;

    @RequestMapping("/test")
    @ResponseBody
    public String selectall(){

        List<Department> list=iDepartmentService.selectall();
        System.out.println("controller>>>>>>>>>>>"+ JSON.toJSONString(list));

        return JSON.toJSONString(list);
    }
}
